import React from 'react';
import { Calendar as AntdCalendar } from 'antd';
import type { CalendarProps as AntdCalendarProps } from 'antd';
import { createStyles } from 'antd-style';
import type { Dayjs } from 'dayjs';

export interface CalendarProps extends AntdCalendarProps<Dayjs> {
  /**
   * @description 自定义样式类名
   */
  customClassName?: string;
}

const useStyles = createStyles(({ token, css }) => ({
  calendar: css`
    border-radius: ${token.borderRadius}px;
  `,
}));

const Calendar: React.FC<CalendarProps> = ({ customClassName, className, ...restProps }) => {
  const { styles, cx } = useStyles();
  
  const calendarClassName = cx(
    className,
    customClassName,
    styles.calendar
  );

  return <AntdCalendar className={calendarClassName} {...restProps} />;
};

export { Calendar };
export default Calendar;

